package com.tools.sqlmaker.make.impl;

import com.tools.sqlmaker.entry.OrgInfo;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author: zhoubin
 * @date: 2023/9/7
 */
public class RabbitMqCommLinkConfMaker extends CommLinkConfMaker {

    public RabbitMqCommLinkConfMaker(OrgInfo info) {
        super(info);
    }

    @Override
    public List<Map<String, Object>> getParamList() {
        OrgInfo info = getOrgInfo();
        List<String> sysQmCodeList = getSysQmCodeList();
        List<Map<String, Object>> paramList = new ArrayList<>();

        String[] exchangeList = info.getExchange();
        for (String sysQmCode : sysQmCodeList) {
            char qmCodeNum = sysQmCode.charAt(sysQmCode.length() - 1);
            for (int i = 0; i < exchangeList.length; i++) {
                char qmNum = (char) (65 + i);

                Map<String, Object> map = makeDefaultMap();
                map.put("local_qm_code", sysQmCode);
                map.put("rmt_biz_q_code", "MSG_" + getQmCodePre() + qmNum + "_" + qmCodeNum);

                paramList.add(map);
            }
        }

        return paramList;
    }
}
